package com.erp.ae.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.erp.ae.service.IAeSellerStoreService;
import com.erp.ae.service.IAeStoreOrderReceiptAddressService;
import com.ruoyi.ae.api.domain.AeStoreOrderReceiptAddress;
import com.ruoyi.common.core.domain.R;
import com.erp.ae.utils.AeApiUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/ae/sellerStore")
public class AeSellerStoreController {

    private final IAeSellerStoreService iAeSellerStoreService;
    private final IAeStoreOrderReceiptAddressService aeStoreOrderReceiptAddressService;

    /**
     * 获取店铺信息
     *
     * @return
     */
    @GetMapping("/querySellerStoreInfo/{storeId}")
    public R<Object> querySellerStoreInfo(@PathVariable("storeId") String storeId) {
       return iAeSellerStoreService.querySellerStoreInfo(storeId);

    }


    /**
     * 查询商家店铺诊断问题列表
     *
     * @return
     */
    @GetMapping("/storeDiagnosis")
    public R<Object> storeDiagnosis(Long storeId) {
        //生成参数Map
        //获取店铺的accessToken
        return iAeSellerStoreService.storeDiagnosis(storeId);
    }

    /**
     * 根据订单编号，获取订单地址信息
     * @param orderId
     * @return
     */
    @GetMapping("/getAddressByOrderId")
    public AeStoreOrderReceiptAddress getAddressByOrderId(@RequestParam("orderId") Long orderId) {
        return aeStoreOrderReceiptAddressService.selectAddressByOrderId(orderId);
    }

    /**
     * 全托管 获取商家账号列表
     */
    @GetMapping("/queryGlobalSellerRelation/{storeUserName}")
    public R<Object> queryGlobalSellerRelation(@PathVariable("storeUserName") String storeUserName) {
        return iAeSellerStoreService.queryGlobalSellerRelation(storeUserName);
    }

}
